<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ (c) 2018 Open Source Geospatial Foundation - all rights reserved
  ~ This code is licensed under the GPL 2.0 license, available at the root
  ~ application directory.
  ~
  -->
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:sec="http://www.springframework.org/schema/security"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
          http://www.springframework.org/schema/security
          http://www.springframework.org/schema/security/spring-security-3.0.4.xsd">

	<bean class="org.geoserver.platform.ModuleStatusImpl">
		<constructor-arg index="0" value="sec-keycloak" />
		<constructor-arg index="1" value="GeoServer Keycloak Security" />
	</bean>

	<!-- enables Keycloak as an auth-provider -->
	<bean id="keycloakFilterProvider"
		class="org.geoserver.security.keycloak.GeoServerKeycloakAuthenticationProvider" />

	<!-- GeoServer UI for Keycloak auth config -->
	<bean id="keycloakPanelInfo"
		class="org.geoserver.web.security.keycloak.KeycloakAuthFilterPanelInfo">
		<property name="id" value="security.keycloakAuthFilter" />
		<property name="shortTitleKey" value="KeycloakAuthFilterPanel.short" />
		<property name="titleKey" value="KeycloakAuthFilterPanel.title" />
		<property name="descriptionKey" value="KeycloakAuthFilterPanel.description" />
	</bean>

	<!-- Keycloak role service panel infos -->
	<bean id="keycloakRoleServicePanelInfo" class="org.geoserver.web.security.keycloak.KeycloakRoleServicePanelInfo">
		<property name="id" value="security.keycloakRoleService" />
		<property name="shortTitleKey" value="KeycloakRoleServicePanel.short"/>
		<property name="titleKey" value="KeycloakRoleServicePanel.title"/>
		<property name="descriptionKey" value="KeycloakRoleServicePanel.description"/>
	</bean>

	<!-- login button -->
	<bean id="keycloakFormLoginButton" class="org.geoserver.web.LoginFormInfo">
		<property name="id" value="keycloakFormLoginButton" />
		<property name="titleKey" value="" />
		<property name="descriptionKey" value="KeycloakAuthFilterPanel.description" />
		<property name="componentClass" value="org.geoserver.web.security.keycloak.KeycloakAuthFilterPanel" />
		<property name="name" value="keycloak" />
		<property name="icon" value="keycloak.png" />
		<property name="filterClass" value="org.geoserver.security.keycloak.GeoServerKeycloakFilter" />
		<property name="loginPath" value="web?j_spring_keycloak_login=true" />
	</bean>

</beans>
